/**
 * @function gulp入口文件
 * @author anytao
 * @created 2016-07-01
 * @version 1.0
 */
var gulp = require('gulp'),
    nodemon = require('gulp-nodemon'),
    opn = require('opn'), //打开浏览器
    gulpSequence = require('gulp-sequence');//控制gulp执行任务的顺序

gulp.task('server', function() {
    nodemon({
        script: 'www/development.js',
        // ignore: ['*.*'],
        watch: ['www/development.js'],
        env: {
            'NODE_ENV': 'development'
        }
    }).on('start', function() {
        console.info('server is running http://localhost:8360');
    }).on('restart', function() {
        console.log('server is restarted!')
    });
})

//打开浏览器
gulp.task('openBrowser', function() {
    opn('http://127.0.0.1:8360/');
});

gulp.task('default',gulpSequence('server','openBrowser'));